Part Number Hot Search : 
VP2019H VP2019H SMAJ4469 TPC6012 FQD12N20 RN2414 5KP24 250020
Product Description
Full Text Search
 

To Download AN4025 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  1 intr oduction this document describes a combinational medical de vice designed to inte grate both a lo w-end glucometer and a blood pressure monitor . no w adays, people suf fering from chronic de generati v e diseases such as h ypertension and diabetes can de v elop a plurimetabolic syndrome. this syndrome and both diseases in the same patient share some risk f actors such as obesity , h ypercholesterolemia, and atherosclerosis. medical combinational de vices tar get this ne w mark et and not only is po wer consumption a tar get, b ut bringing a better solution for disease control. this application note addresses medical de vices implemented with freescale technology . by using the mc9s08ll16 this de vice is ener gy effcient. it includes a medical usb stack programmed into the mc9s08js16 for communication and the mpxv5050gp pressure sensor . a glucometer is a de vice for measuring le v els of glucose concentration in the blood. this de vice is usually portable and is used at home for monitoring diabetic-patients. a blood pressure monitor is a de vice that detects systolic and diastolic blood pressure, heart rate, and mean arterial pressure for patients who suf fer or are at risk of de v eloping high blood pressure. ? 2009 f reescale semiconductor , inc. document number : AN4025 freescale semiconductor re v . 1, 4/2010 application note implementing a glucometer and blood pressure monitor medical de vices ro xana suarez and carlos casillas b y: r t a c americas guadalajara me xico contents introduction ........................................................... 1 1 glucometers and diabetes ..................................... 2 2 blood glucose monitor ......................................... 4 3 blood pressure monitor and hypertension ........... 6 4 blood pressure monitor ....................................... 7 5 t echnology and medical de vices ...................... 11 6 lcd dri v er ......................................................... 11 7 bluetooth connecti vity ....................................... 17 8 micro sd card .................................................... 20 9 po wer management ............................................. 24 10 errors system ...................................................... 25 11 personal healthcare de vice class and medical usb stack applications ............................................... 25 12 user guide .......................................................... 26 13 conclusion ........................................................... 30 14 references ........................................................... 30 15
2 glucometer s and diabetes diabetes is one of the most common diseases today . it is essential to produce glucometers whose one of man y adv antages is to empo wer diabetics to tak e care of themselv es without the need to visit doctors. glucometers help to detect and confrm h ypoglycemia and infections. high blood sug ar may also be a sign of infection or illness that needs to be treated. 2.1 diabetes fundamentals diabetes mellitus commonly kno wn as diabetes is a common health problem throughout the w orld. it pre v ents the body from producing enough insulin, does not produce insulin, produces defecti v e insulin, or has resistance to the same. insulin is a hormone produced in the pancreas. according to the w orld health or g anization statics, the global pre v alence of diabetes mellitus is approximately 155 million people and e xpected to increase to 300 million in the year 2025. medical mana g ement of diabetes and heart disease book , marcel dekk er inc. glucometry is a technique that obtains the v alue of glucose concentration in peripheral or central blood. these v alues e xpressed either in mgr/dl or mmol are important clinical v alues for metabolic disorders such as diabetes mellitus, denutrition, and other consequences lik e h yperosmolar coma, malabsorption syndrome, and most critical h ypoglycemia. a glucometer and proper pharmaceutical treatment is fundamental for glycemic control of diabetic patients. at home, some glucometers include dif ferent kinds of strips to monitor other v ariables such as k etones which are produced when a patient is e xperiencing h yper glycemia. figure 1 sho ws a general diagram of a blood pressure monitor . it sho ws dif ferent peripherals for communication between the user and the de vice. the most important part is the test strip, this is the sensor to collocate the blood and get a determined measurement with the analog-to-digital con v erter (adc) of the microcontroller unit (mcu). the other peripherals depend on the designer . figure 1. blood glucose monitor b loc k dia gram 2.2 glucose sensor s the frst step to measure the glucose in the blood is to con v ert the glucose concentration into a v oltage or current signal, this is possible with special sensor strips for amperometry . the sensor uses a platinum and silv er electrode to form part of an electric circuit where h ydrogen peroxide is electrolyzed. the h ydrogen peroxide is produced as a result of the oxidation of glucose on a glucose oxide membrane. the current through the circuit pro vides a measurement of the concentration of h ydrogen peroxide, gi ving the glucose concentration. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 2 glucometer s and diabetes
figure 2. electr ode reactions between glucose and gluconic acid the sensor used as a blood-glucose meter is based on a glucose oxide electrode. the glucose oxides were immobilized in a platinized acti v ated carbon electrode. the enzyme electrode w as used for amperometry determination by using an electrochemical detection of enzymically produced h ydrogen peroxide. the sensor is composed of v arious electrodes; a glucose oxide membrane layer , a polyurethane flm that is permeable by the glucose, oxygen, and h ydrogen peroxide. 2.3 amper ometr y amperometry measures electric current between a pair of electrodes that are dri ving the electrolysis reaction. oxygen dif fuses through the membrane and a v oltage is applied to the pt electrode reducing o 2 to h 2 figure 3. t est strip basic b loc k dia gram these reacti v e electrodes are amperometric type sensors that use a three electrode design. this approach is useful when using amperometric sensors due to the reliability of measuring v oltage and current in the same chemical reaction. three electrode models use a w orking electrode (we), reference electrode (re), and a counter electrode (ce). after this current is produced this must be changed to v oltage for processing by the mcu. this action is performed by the transimpedance amplifer . finally , the mcu detects and processes this signal with the adc module. f or a transimpedance amplifer and sensor designs for medical applications go to medical application user guide at www .freescale.com . implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 3 f reescale semiconductor , inc. glucometer s and diabetes
figure 4. chip sc hematic use an amperometric determination method with a constant potential of 0.3v used in the portable meter . the current response of the sensor is linear with a glucose concentration in the range of 5 to 30 mmol/ l and a f ast response time of about 20 seconds. 3 blood glucose monitor this section e xplains ho w to de v elop a medical de vice for measuring the blood glucose le v el. this de vice operates placing a relati v ely small drop of blood on a disposable test strip that interf aces with a digital meter . w ithin seconds the le v el of blood glucose is sho wn on the liquid crystal display (lcd). 3.1 t ransimpedance amplifier the transimpedance amplifer consists of an operational amplifer and a feedback resistor between the output and the ne g ati v e input. the positi v e input can be connected to either gnd or used for of fset calibration. 3.2 glucose software over vie w the v oltage source is al w ays at 3.3 v . t o start taking adc samples, the source v oltage must go to 0.3 v . the connection between the source and the application contains a v oltage re gulator of 3.3 v . y ou can pro vide v oltage to the system by using a 9 v battery . t ak esample function the function confgures the adc module and starts con v ersion. it compares the adc con v ersion obtained with value1 which is 60. if the adc con v ersion is lo wer than this v alue, the mcu goes into stop mode, and after 20 seconds sends an error message to the lcd. void takesample (void) { . . . adc_start(); strip_ctrl =stripvoltage300mv; //0.3v supply countsec=0; adc_start_conversion (2); drop=1; while(adc_get_newconversion(2)<=value1) { adc_start_conversion (2); _stop; if(countsec==20) { error(1); option=6; drop=0; implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 4 blood glucose monitor
break; } } if no errors occur . the adc con v ersion continues and sets the ranges as sho wn in the code belo w . the samples obtained must be the follo wing: ? range 0 adc con v ersion < 128, ? range 1 141 < adc con v ersion <= 292 ? range 2 239 < range 2 adc con v ersion<=407 ? range 3 408 < range 3 adc con v ersion<= 537 ? range 4 539 < range 4 adc con v ersion<= 752 ? range 5 adc con v ersion >752. indicates a high le v el of glucose no te the adc module resolution is 0.8058 mv/count. while(countsec<6) { blcd_charposition = 10; vfnlcd_write_char (0x30+(5-countsec)); if(countsec==1) { adc_start_conversion (2); sample=adc_get_newconversion(2); if(sample<128) { blcd_charposition = 0; vfnlcd_write_char ('0'); range=0; } . . . } the code belo w sets the glucose le v els for each range. y ou ha v e to change the information in range 2, range 3, and range 4 in the lines as commented belo w . finally , determine the glucose le v el with the equation: glucose = x + midpoint the x v ariable for: ? range 1 = 35 ? range 2 = 86 ? range 3 = 166 ? range 4 = 201 if(range==1) // changes for 2, 3 or 4 { low=0; high=51; midpoint=0; while (low intialization range arrays: uint16 range1[] = {179,... ,275}; uint16 range2[] = {275, .. ,391}; uint16 range3[] = {384, .. ,545}; uint16 range4[] = {545, .. ,763}; the t ak esample function disables the adc and displays the results on the lcd. displayresults(); vfnlcd_all_segments_off (); task=5; 4 blood pressure monitor and hyper tension because h ypertension (high blood pressure) becoming more and more common, technology has had to de v elop medical de vices to help control these diseases. these portable de vices allo w monitoring blood pressure at home. 4.1 hyper tension fundamentals hypertension or high blood pressure is a condition when the blood pressure in the arteries is chronically ele v ated. in e v ery heart beat, the heart pumps blood through the arteries to rest of the body . blood pressure is the force of the blood that is pushing up ag ainst the w alls of the blood v essels. if the pressure is too high, the heart has to w ork harder to pump and this can lead to se v eral diseases. a blood pressure monitor is a de vice used to measure arterial pressure as blood is pumped a w ay from the heart. t ypically , from a user's perspecti v e, a monitor includes an infatable cuf f to restrict blood fo w and a manometer (pressure meter) to measure the blood pressure. from a system designer s perspecti v e a blood pressure monitor is more comple x. it consists of a po wer supply , motor , memory , pressure sensor , and user interf aces that can include a display , k e ypad, or touchpad, and audio as well as optional usb or wireless communication interf aces. f or more information go to the blood pressure monitors webpage . implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 6 blood pressure monitor and hyper tension
figure 5. blood pressure monitor g eneral b loc k dia gram 5 blood pressure monitor this section e xplains the hardw are background to de v elop a blood pressure monitor . the functionality of the mpxv5050gp pressure sensor , the hardw are, and softw are de v eloped are also described. 5.1 pressure sensor this application implements the motor control mentioned in the figure 5 dri v en by a pulse width modulation (pwm). the principal de vice for this application is the mpxv5050gp pressure sensor . this is because it depends on the pressure detected by the mcu so that the motor either turns on or turns of f. also important is an air compressor controlled by the motor and v alv e. the pressure sensor pro vides a signal that splits in tw o. one without a flter , and the other with a flter that remo v es noise. mpxv5050gp medical features: ? p atented silicon shear stress strain g auge ? pressure range up to 300 mm hg (consult the datasheet) ? polysulfone case material (medical, class v appro v ed) 5.2 har d wareblood pressure monitor the motor must be connected to the mini air pump v alv e to generate air for the air chamber , at the same time, the mini air pump has to be connected to a cuf f, an air reference, and to the v alv e. therefore when the motor is disabled and the v alv e enabled, the cuf f starts to defate. the pressure sensor is also connected to the cuf f for taking in e v ery moment and measuring the pressure. figure 6 sho ws ho w to connect these elements. a hose can be used. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 7 f reescale semiconductor , inc. blood pressure monitor
figure 6. pressure gaug e b loc k dia gram figure 7. motor , mini air pump, v alve figure 8. pressure sensor connection 5.3 softwareblood pressure monitor bloodpr essur emonitor .c in this fle are the determined incremented and decremented states to start to measure blood pressure. the pwm confguration controls the motor and the v alv e. the timer/pulse width modulator (tpm) confguration as pwm edge-aligned using channel 0 for motor control and channel 1 for v alv e control is described belo w . there are also some v alues used for the motor and v alv e control. the v alues can be changed depending on the hardw are implementation. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 8 blood pressure monitor
clock confguration: ? clock sourcebus clock/64 = 10 mhz/64 = 156.250 khz ? clock c ycle6.4 us pwm confguration: ? counter v alue0x200 (hex) = 512 (dec) = 3.27 ms per duty c ycle ? motor pwm0x80 (hex) = 128 (dec) = 25% of duty c ycle ? v alv e pwm0x 100 (hex) = 256 (dec) = 50% of duty c ycle no te this v alue is used to generate the pwm in the tpmxmod re gister . although the motor and v alv e pwm ha v e the same clock source the y are ne v er enabled at the same time. 5.4 obtaining blood pressure measurements sho wn belo w is the maximal v alue that corresponds to 180 mm hg. when the mcu detects this pressure the system turns of f the motor and starts to stabilize. ho w blood pressure and v oltage relate and compare to each other is e xplained belo w . a pressure of 180 mm hg is tak en as a maximal v alue. first, it is necessary to mak e the con v ersion from mm hg to kp a, because the sensor datasheets sho w v alues in kp a. con v ersion of mm hg to kp a1 kp a=7.50061505043 mm hg then 180 mm hg=24 kp a. it is possible with this con v ersion to get an approximate v oltage. according to the graphic and transfer function that the pressure sensor datasheet pro vides, it is possible to kno w the v oltage present when the pressure sensor detects 180 mm hg. t ransfer function3.3*[(0.018*24) + 0.04] = 1.55 v (this v alue is just an appr oximation without err or) figure 9. v olta g e output ver sus pressure the adc module w as confgured in a 12-bit mode and can ha v e counts of up to 4095. t aking the v oltage supply of 3.3 v the adc resolution is approximately 0.8058 mv/count . it is necessary to kno w when the pressure reaches 180 mm hg which according to the transfer function the sensor deli v ers 1.55 v . this data lets you kno w ho w man y counts are necessary to detect 180 mm hg=1.55 v/0.8058 mv=1923 counts to pro vide a range of error . the systems uses 1900 counts to ha v e a mar gin of error . if (gu16pressure>1900) //180 mm hg implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 9 f reescale semiconductor , inc. blood pressure monitor
5.5 motor and v alve contr ol after the pressure reaches the maximal v alue of 180 mm hg the program starts to stabilize the system. it establishes a shorter duty c ycle for motor control and a longer duty c ycle for v alv e control and starts to measure the blood pressure. the fo wchart belo w sho ws ho w to implement the motor control. figure 10. motor contr ol flo wc har t the fo wchart sho ws both pressures, the systolic which represents the maximum pressure e x erted (cuf f infates) when the heart contracts and diastolic which represents the pressure in the arteries when the heart is at rest (cuf f defates). 5.6 obtaining hear t beats at bloodpressure .c blood pressure is one of the principal vital signs. blood pressure is a force on the w alls of blood v essels e x erted by the blood circulating. during each heartbeat, blood pressure v aries between systolic pressure and diastolic pressure. f or a better diagnose and control of h ypertension it is important to obtain the heart rate. 5.6.1 obtaining the hear t rate the pressure sensor has one output split in tw o. the tw o outputs are tak en from the pressure sensor to remo v e noise to get a better measurement. one output is fltered and obtains the specifc frequenc y of the heart. the other output is for sensing the pressure recei v er . when the cuf f is attached to a person s arm and it is defating you can see slight v ariations in the o v erall pressure on the cuf f. this v ariation in the pressure from the cuf f is actually due to the pressure change from blood circulating. this v ariation is amplifed through a high-pass flter designed at 1 hz and set to an of fset. the heart rate is calculated with the resulting signal. 5.6.2 oscillometric method this method consists in taking samples from the oscillations caused by the blood fo w . while the cuf f is defated from the systolic le v el, the blood starts to circulate through the obstructed artery producing vibrations. when the pressure cuf f is decreasing, the oscillations increase up to a maximal amplitude; after decreasing, the blood fo w is normal. the pressure in the cuf f in the maximal oscillation is kno wn as mean arterial pressure (map). when oscillation starts to increase quickly , this is the systolic pressure (sbp)(top number). when oscillations decrease quickly , this is the diastolic pressure (dbp). figure 11 sho ws the pressure and the heart rate. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 10 blood pressure monitor
figure 11. oscillator y pressure cur ve 5.6.3 mean ar terial pressure mean arterial pressure (map) is a term used in medicine to describe an a v erage blood pressure in an indi vidual. it is defned as the a v erage arterial pressure during a single cardiac c ycle. at normal resting heart rates the map can be approximated using the more easily measured systolic pressure (sp) and diastolic pressures (dp): 6 t ec hnology and medical de vices medical diagnostics are no w made with high technology a v oiding continuous visits to the hospital. making remote control lcds can be used as an interf ace to communicate with the patient at dif ferent stages of the disease and generate alarms in chronic situations. the application also has dif ferent w ays to communicate with e xternal de vices such as bluetooth, sd card, and usb. 7 lcd driver this application w as de v eloped using the mc9s08ll16 series. this de vice pro vides an lcd module that controls up to 192 se gments and generates the w a v eforms necessary to dri v e an lcd. the lcd used for this application is a glass with 29 se gments. 7.1 modes of operation and p o wer suppl y in the mc9s08ll16 series the lcd module can be confgured to operate in stop and w ait modes. the lcd module can operate in stop2 with all clocks turned of f. according to the lcd glass specifcations this must be supplied at 3.3 v . f or this confguration v ireg is connected to v ll1 internally and a range of 1v for the v ireg is chosen. v ll2 and v ll3 are generated by a char ge pump. figure 12 sho ws the connections between the lcd glass and the mcu. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 11 f reescale semiconductor , inc. t ec hnology and medical de vices
7.2 lcd har d ware figure 12 sho ws ho w to connect the lcd pins and capacitors to v ll1 , v ll2 , and v ll3 , a char ge pump source is enabled and it is necessary to connect a capacitor in vcap1 and vcap2 pins. it also describes the general connection between the lcd and the mcu. figure 12. connection to ll16 7.2.1 lcd segment specs this section pro vides information of the lcd dri v er de v eloped with the ll16 microcontroller that allo ws confguration, customization of dif ferent se gments, and special symbols depending on the lcd glass used. the application note titled lcd driver specifcations (document an3796) is a v ailable at the freescale website . implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 12 lcd driver
figure 13. lcd glass t able 1 sho ws the custom glass w orksheet. t ab le 1. lcd specs com4 com3 com2 com1 pin com4 1 com3 2 com2 3 com1 4 b4 b3 b2 b1 5 1d 1e 1f 1a 10 1c 1g 1b 11 implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 13 f reescale semiconductor , inc. lcd driver
com4 com3 com2 com1 pin 2d 2e 2f 2a 12 2c 2g 2b 13 3d 3e 3f 3a 14 3c 3g 3b 15 t4 t3 t2 t1 16 4d 4e 4f 4a 17 4c 4g 4b 18 5d 5e 5f 5a 19 5c 5g 5b 20 6d 6e 6f 6a 21 6c 6g 6b 22 7d 7e 7f 7a 23 7c 7g 7b 24 8d 8e 8f 8a 25 8c 8g 8b 26 p1 p2 27 9d 9e 9f 9a 28 9c 9g 9b 29 10d 10e 10f 10a 30 10c 10g 10b 31 t5 t6 32 7.3 lcd software general lcd softwar e fo wchart figure 14 sho ws the lcd sequence. it is in an infnite loop that al w ays returns to the t ask management switch. t o sho w the dif ferent options of the application this function controls a v ariable named t ask. this v ariable is confgured with a 1 to enter in the glucometer's principal menu, 2 for the blood pressure monitor de vice (choose an application), 3 to sa v e the measurement, 4 for bluetooth communication, 5 for usb communication, and 6 to enter stop mode. t o change the status of the t ask v ariable assign the v alue necessary . implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 14 lcd driver
figure 14. lcd flo wc har t lcd .c the principal function of this fle is to confgure the lcd module, set the frontplanes, backplanes, the po wer supply , the clock source, and the duty c ycle for the w a v es to generate the messages in the lcd glass. belo w you can see ho w to enable the lcd pins, and set which lcd pins will be backplanes and coms. t ab le 2. lcd pins and bac kplane configurations functionality p arameter s function enab le the corresponding lcd pin f or the lcd oper ation. regnumnumber of the register to wr ite . maskmask to habilitate lcd pins enablelcdpins (regnum,mask) enab le the corresponding lcd pin f or the bac kplane oper ation. regnumnumber of the register to wr ite . maskmask to select bac kplanes enablebackplane (regnum, mask) implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 15 f reescale semiconductor , inc. lcd driver
figure 15. lcd .c structure lcdmessages.c this application depends on the function and option chosen. lcdmessages.c contains functions that determine actions tak en by the lcd. f or more information consult the lcdmessages.c fle directly . this fle contains a message that informs communication status of the bluetooth and the usb. it also pro vides a message to inform when there is an error and le v el v oltages. t ab le 3. comm unications status functionality p arameter s function sho ws the application options that the system has appliindicator to each application application_menu(uint8 ap- pli) sho ws the configure options that the system has configindicator f or diff erent options of configur ation configure_menu(uint8 con- fig) sho ws the memor y options selindicates if it is the memor y f or the b lood pressure monitor or f or gluc- ose choosememory(bool sel) sho ws on the displa y the inf or mation stored on the sd card. memindicates what inf or mation sho ws glucose or b lood pressure measurements memorydisplay(uint8 mem) message bef ore the b lood pressure measurement none readybp(void) sho ws on the displa y the current inf or mation measured none displayresults() sho ws the current v alue of maxpressure and sensorcalibr ation on the displa y infsa v es the v alues tak en from the adc bp_configure(uint16 inf) sho ws the memor y selected on the displa y none select_memory_config- ure(void) sho ws memor y function options on the displa y cindicates what actions the memor y is taking displaymemoryfunction(uint8 c) sho ws comm unication option selected on the displa y . none select_communication_config- ure(void) sho ws the option selectedusb enab le , bluetooth enab le , or both disab led none display_communication(void) implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 16 lcd driver
8 bluetooth connectivity this communication helps short range transmission of data from medical de vices to mobile phones and computers. this feature in medical de vices helps to ha v e contact between the patient and the doctor without ha ving to go to the doctor's offce. 8.1 bluetooth theor y bluetooth is an open wireless protocol that creates personal area netw orks (p ans) and e xchanges data o v er short distances between fx ed or mobile de vices. it can connect se v eral de vices and o v ercome problems of synchronization. bluetooth pro vides 10 meters of distance to set communication at a speed of up to 1 mb/s, high compatibility to most computers, and it is not necessary to implement a special netw ork for communication. 8.1.1 ser vice disco ver y application pr ofile (sd ap) service disco v ery protocol (sdp) pro vides a means for applications to disco v er what services are a v ailable and to determine characteristics of those a v ailable services. a specifc service disco v ery protocol is needed in a bluetooth en vironment. the service disco v ery protocol defned in bluetooth specifcation is intended to address unique characteristics of a bluetooth en vironment. 8.2 bluetooth har d ware in this application the lmx9838 bluetooth serial port module is used. it inte grates the bluetooth 2.0 baseband controller with 2.4 ghz radio, crystal, antenna, and other features. this section e xplains ho w to connect this de vice with the mcu. t o po wer up the de vice some flters were implemented to the vcc, vcc_core, and vcc_io pins as sho wn in figure 16 . it is important to connect the lmx9838 with adequate ground planes and a fltered po wer supply . t o pro vide better performance and lo w po wer consumption an e xternal crystal w as placed at 32 khz. the bluetooth de vice also pro vides tw o pins to connect leds that indicate link status and rf traffc. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 17 f reescale semiconductor , inc. bluetooth connectivity
figure 16. bluetooth driver because this application uses usb and bluetooth communication both through the serial communication interf ace (sci) module, a qs3vh253q multiple xor is used to control what communication is used. figure 17. comm unication m ultiple xor 8.2.1 baud rate configuration the lmx9838 pro vides a u ar t interf ace to communicate with the mcu through the sci module. the u ar t interf ace supports formats of 8-bit data with or without parity with one or tw o stop bits. it can operate at standard baud rates from 2400 bits/s up to a maximum baud rate of 921.6 kbits/s. the u ar t baud rate is confgured during startup by checking option pins op3, op4, and op5. t able 4 sho ws dif ferent u ar t frequenc y settings. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 18 bluetooth connectivity
t ab le 4. u ar t frequenc y settings baud rate op3 op3 op3 read from nvs 1 0 0 1 9.6 kbps 1 0 1 115.2 kbps 0 1 1 921.6 kbps 1 1 1 1 . system par ameters in non-v olatile stor age when the v alue is at 1 this means a 1 k pull-up resistor must be placed. this confguration is with the lmx9838 bluetooth ? serial port module. in the mc9s08ll16 the sci baud rate must also be confgured in the sci_init (void) function. void sci_enable(void) { scibd = br; /* sci baud rate = 10mhz/(16*65) = 9615 bps */ scic1_loops=0; scic2_te=1; scic3_txdir=1; } ******************************************************************************* #ifndef __sci_h_ #define __sci_h_ #include "mytypes.h" #define br 54 /* baud rate = 9600 (baud rate mismatch = 0.160 %) */ #define error 0x07 void sci_enable(void); void sci_send_byte(uint8); #endif /* __sci_h_ */ 8.3 bluetooth software bluetooth.h in the bluetooth.h fle are all the declared necessary functions to implement bluetooth communication. the functions help to connect and disconnect the system. it also confgures the serial port and when to reset. function declarations: set_bluetooth_communication(void) bt_sfw_reset(void) bt_send_data(void) bt_sdap_connect(void) bt_sdap_spp_service_browse(void) bt_sdap_disconnect(void) bt_create_spp_connection(void) bt_send_data(void) implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 19 f reescale semiconductor , inc. bluetooth connectivity
figure 18. bluetooth software flo wc har t bluetooth.c t ab le 5. bluetooth functions functionality p arameter s function reset and choose betw een bluetooth or usb comm unication none uart_sel= uart_bluetooth set configur ation to comm unicate the application with remote de vices using bluetooth. first, the hardw are reset is gener ated to activ ate module . the sci module is configured to function with bluetooth through a vir tual ser ial por t. after configur ing the de vice is ready to set comm unication with other de vices . none set_bluetooth_communica- tion(void) create vir tual ser ial por t with the sci none bt_create_spp_connection() send inf or mation none bt_send_data() 9 micr o sd car d f or this application it is necessary to ha v e an interf ace to sa v e and transport information easily and effciently . this section e xplains the connections and softw are for an sd card dri v e. figure 19. sd car d connection dia gram an sd card is connected to the microcontroller through the serial peripheral interf ace spi. the sd card functions as a sla v e and the mcu as master . implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 20 micr o sd car d
figure 20. conn_sd_card 8 9.1 softwaremicr o sd car d sd .h fle the sd card communication is a command protocol, these commands are declared at the sd.h fle. functions are located in the sd.c fle. the follo wing commands are the principal commands. t ab le 6. sd car d command description command resets the sd memor y card sd_cmd0 initialization process sd_cmd1 chec k mode 0 and mode 1 sd_cmd6 host supply v oltage sd_cmd8 csd sd_cmd9 cid sd_cmd10 stop tr ansmission sd_cmd12 sends status register sd_cmd13 sets a b loc k length sd_cmd16 reads a b loc k sd_cmd17 contin uously tr ansf ers sd_cmd18 wr ites a b loc k sd_cmd24 contin uously wr ites up to stop mode sd_cmd25 prog r ams prog r ammab le bits of the csd sd_cmd27 sets the wr ite protection bit sd_cmd28 clears the wr ite protection sd_cmd29 sends the status of the wr ite protection sd_cmd30 sets the address of the first wr ite b loc k sd_cmd32 sets the address of the last wr ite b loc k sd_cmd33 er ases all pre viously selected wr ite b loc ks sd_cmd38 used to set or reset the pass w ord or loc k and unloc k the card sd_cmd42 implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 21 f reescale semiconductor , inc. micr o sd car d
description command defines the ne xt command sd_cmd55 used either to tr ansf er a data bloc k or to get a data bloc k sd_cmd56 reads the ocr register of a card sd_cmd58 t ur ns the crc option on or off sd_cmd59 9.2 sd car d initialization t o use an sd card it is necessary to follo w a specifc sequence for initialization. the frst step is to set the spi clock. the mcu must then send 80 clock signals before it starts communication. this allo ws initialization of all the re gisters. the sla v e pin is confgured at zero with this v alue the mcu enters spi mode and a crc byte is sent. after the confguration, the mcu starts to check the block length and place the clock to maximum. figure 21. initialization flo wc har t sd .c fle as e xplained in figure 21 , the sd card initialization is e x ecuted with the sd_init function. the sla v e is enabled and disabled. delays are generated prior v erifying the idle command. the mcu sends a byte that contains information to send the ar gument and the crc w aits for a response from the sla v e de vice. the card is continuously polled with initialization and block-length commands until the idle bit becomes clear , indicating that the card is fully initialized and ready to respond to general commands. f or more information about sd card communication, freescale pro vides the design reference manual titled sd car d reader using the m9s08jm60 series designer refer ence manual (document drm104). t ab le 7. sd car d function functionality p arameter s functions reads an sd card b loc k and if an error occurs a code retur ns u16sd_bloc kindicates the b loc k to read. *pu8 datap ointerbase pointer to store the data from the sd card. sd_read_block(uint32 u16sd_block,uint8 *pu8data- pointer) wr ites one sd card b loc k and if an error occurs a code retur ns . uint32 u16sd_bloc kindicates the b loc k to b wr ite . uint8 *pu8datap ointerbase pointer to store the data to sd card. sd_write_block(uint32 u16sd_block,uint8 *pu8data- pointer) 9.3 stored inf ormation the code belo w sho ws ho w to use the sd.c functions that store diagnostic information (glucose le v els and blood pressure) with dif ferent data. each diagnose is sa v ed dif ferently . f or e xample, the blood pressure diagnostic sa v es the systolic pressure, diastolic pressure, and the heart beats tak en. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 22 micr o sd car d
void storedata (void){ if(sd_init()==1){ error(9); } if (app_id==1){ //save glucose information gmem[1]=glucose; gmem[0]=glucose>>8; gmem[2]=hr; gmem[3]=min; gmem[4]=day; gmem[5]=month; ptrg=&gmem[0]; if(sd_write_block(rg,ptrg)!=0){ error(9); } } if (app_id == 2){ //save blood pressure information bpmem[1]=systolicpressure; bpmem[0]=systolicpressure>>8; bpmem[3]=dyastolicpressure; bpmem[2]=dyastolicpressure>>8; bpmem[5]=heartbeat; bpmem[4]=heartbeat>>8; bpmem[6]=hr; bpmem[7]=min; bpmem[8]=day; bpmem[9]=month; ptrbp=&bpmem[0]; if(sd_write_block(rp,ptrbp)!=0){ error(9); } } void bpreadmemory (void){ ptrbp=&bpmem[0]; if(!sd_read_block(rp,ptrbp)){ systolicpressure=(bpmem[0]<<8)+bpmem[1]; dyastolicpressure=(bpmem[2]<<8)+bpmem[3]; heartbeat=(bpmem[4]<<8)+bpmem[5]; hr=bpmem[6]; min=bpmem[7]; day=bpmem[8]; month=bpmem[9]; memorydisplay(2); } else{ error(9); } } 9.4 read inf ormation this code is to read the information pro vided by the sd card. blood pressure and glucose information. void bpreadmemory (void){ ptrbp=&bpmem[0]; implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 23 f reescale semiconductor , inc. micr o sd car d
if(!sd_read_block(rp,ptrbp)){ systolicpressure=(bpmem[0]<<8)+bpmem[1]; dyastolicpressure=(bpmem[2]<<8)+bpmem[3]; heartbeat=(bpmem[4]<<8)+bpmem[5]; hr=bpmem[6]; min=bpmem[7]; day=bpmem[8]; month=bpmem[9]; memorydisplay(2); } else{ error(9); } } *************************************************************************************** void greadmemory (void){ ptrg=&gmem[0]; if(!sd_read_block(rg,ptrg)){ glucose=(gmem[0]<<8)+gmem[1]; hr=gmem[2]; min=gmem[3]; day=gmem[4]; month=gmem[5]; memorydisplay(1); } else{ error(9); } } 10 p o wer mana g ement it is important to correctly implement the po wer source to control the analog and digital v oltage for dif ferent stages in the system. ev en when the whole system is supplied with the same v oltage, the motor and the control consume more electrical current. it is necessary to separate the v oltage source and implement the circuit s isolation v oltages and gnds. figure 22 sho ws the principal circuit to supply v oltage. the system recei v es 9 v and depending if the switch is on or off , allo ws passing the re gulated v oltage of 3.3 v with a capacitor coupling to ensure the v oltage le v el and impro v e the signal inte gration. figure 22. v olta g e and gnd isolations 10.1 p o wer mana g ement and the mc9s08ll16 the mc9s08ll16 microcontroller has an operating v oltage of 1.8 v to 3.6 v that allo ws the lcd, sci ,and spi to w ork with lo w po wer consumption. this de vice pro vides w ait and stop modes. the system pro vides three po wer sources from the principal v oltage source. ? inte grated circuit v oltage ? motor and v alv e v oltage ? pressure sensor supply v oltage implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 24 p o wer mana g ement
a switch with transistors is implemented for the pressure sensor v oltage source. the mcu sends a signal to the q2 base. the principal v oltage source connects to gnd and the pressure sensor v oltage source is then generated. t ab le 8. p o wer sour ce de vice sour ce mc9s08ll16l, max4734, lmx9838sb , mc9s08js16, sd card, b uzz er , qs3vh253q, push b uttons . (control or digital section) +3_3v_d motor and v alv e +3_3v_m pressure sensor +3_3v_press figure 23. pressure b loc k on/off po wer 11 err or s system the system application generates errors in dif ferent situations. t o pre v ent an y damage in the system and for patient health alerts an error is generated. the errors are identifed with a number and each number of errors alert about dif ferent situations. ? error(1)w aits a fe w seconds and if a strip is not detected, the system considers that the strip is used. ? error(2)w aits a fe w seconds and if a strip is detected, b ut does not ha v e a reaction, the system considers that there is no blood sample. ? error(3)detects a strip and reaction b ut there is not enough blood to sample. ? error(4)when the pressure detected is higher than 180 mm hg it is possible that there is an escape of air . ? error(5)heart pulse not detected. ? error(6)the diastolic pressure is lo wer than 30 mm hg. ? error(7)bluetooth is enabled b ut cannot mak e a connection. ? error(8)the usb module is enabled b ut cannot mak e a connection. ? error(9)connection error with the sd card. 12 p er sonal healthcare de vice class and medical usb stac k applications personal healthcare de vices class (phdc) it is required to implement methods for sending personal healthcare data to a usb host. the phdc is to enable seamless interoperability between personal healthcare de vices and usb hosts. medical usb stackis based on usb phdc and the ieeeC11073. it is compatible with continua host emulator softw are. this medical usb stack enables microcontrollers with guidelines for continua health alliance connecti vity and is a frst step to test your application prior offcial continua certifcation. freescale pro vides implementations to the phdc using the mc9s08js16. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 25 f reescale semiconductor , inc. err or s system
featured documentacion: ? medusb apirm medical applications usb stac k api refer ence ? medconlib apirm usb de vice api refer ence ? medusb ug medical applications usb stac k user guide ? medconlib ug medical connectivity libr ary user s guide ? mdclusbsftwrfs medical applications usb stac k f act sheet usb hardw are connections: figure 24. mc9s08js16 connection and usb connector 13 user guide after the glucometer and blood pressure monitor are de v eloped, it is time to test the system. chapter 5. blood pressure monitor e xplains ho w to interconnect these de vices and this section e xplains ho w to use the system. first, it is important to localize a connection for the battery , motor , v alv e, glucose connector , and pressure sensor . connection of a 9 v po wer supply to the system is required. no te w ithout a j7 jumper the system remains of f. t urn the system on to start. system: figure 25. ev aluation boar d implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 26 user guide
figure 26. external equipment board connection: j1t urns on the motor j2t urns on the v alv e j39s08ll16 bdm connections j5b a t 9 v battery j6mc9s08js16 bdm connections j7sw1 turns on the system pressure sensor inputrecei v es air pressure from the cuf f f or the complete application you must load tw o programs. the mc9s08ll16 controls the lcd, pressure sensor , motor , and communication peripherals. the mc9s08js16 contains the dri v e for the medical usb stack and operates as a bridge from the sci to usb. the board pro vides tw o bdm connections. the system starts with a glucometer application it is necessary to ha v e ne w strips for testing. the images belo w sho w where to place the blood or the glucose sample and ho w to connect it to the board. figure 27. t est strip implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 27 f reescale semiconductor , inc. user guide
figure 28. using the strip t o start to measure the glucose press the enter b utton. the system displays a blood drop blinking on the lcd that indicates the system is measuring. if a strip is not detected the system displays a message of error 1, 2, 3 and so on, depending on the error number . if there is no action the system changes to lo w po wer mode and turns of f the display . if the functionality is optimal the result is displayed. figure 29. star t glucometer figure 30. glucose le vel the left b utton sends the mcu to a lo w po wer mode and sho ws the off message on the lcd. t o turn of f the system completely , press the enter b utton. t o send the system to the blood pressure monitor application, press the right b utton. t o start to measure the blood pressure press the enter b utton. it is important to pre v ent an y error in the blood pressure measurement to ensure that the motor , v alv e, and cuf f are connected to the system. after the system measures the systolic and diastolic pressure. the system displays a heart symbol for the systolic and diastolic pressure, the heart rate v alues. implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 28 user guide
figure 31. connect b lood pressure monitor figure 32. star t b lood pressure monitor figure 33. systolic and diastolic pressure implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 29 f reescale semiconductor , inc. user guide
figure 34. hear t beats per min utes when the system is po wered on, all the lcd se gments turn on and detect an y damage. figure 35. displa y test 14 conc lusion freescale pro vides a v ariety of de vices with lo w po wer consumption and high performance to de v elop medical applications. fle xibility in selecting the right communication interf ace mak es freescale an adequate solution to use usb or bluetooth. freescale technology de v elops medical de vices such as glucometers and blood pressure monitors to serv e as k e y parts of intelligent hospitals, telehealth solutions, or single end-user monitoring de vices. 15 ref erences freescale pro vides full schematics and source codes for customizing your application and a f aster de v elopment. see a v ailable videos at www .freescale.com/medica l. v ideos at the freescale channel on www .youtube.com/freescale . ? ultra lo w po wer medical de vice demo by freescale http://www .youtube.com/w atch?v=eqtt_sjcmpo ? blood glucose meter with blood pressure monitor http://www .youtube.com/w atch?v=nuork7dgjkm ? continua usb phdc demo http://www .youtube.com/w atch?v=z47ilv0eslq ? electr ocar dio gr aph and heart rate monitor fundamentales (document an4059) at the freescale medical webpage www .freescale.com/medical ? medical mana g ement of diabetes and heart disease book , marcel dekk er inc, authors: burton e. sobel and da vid j. schneider . ? blood pressure monitors a freescale reference design at www .freescale.com implementing a glucometer and blood pressure monitor medical de vices, re v . 1, 4/2010 f reescale semiconductor , inc. 30 conc lusion
ho w to reac h us: home p a g e: www .freescale .com w eb suppor t: http://www .freescale .com/suppor t usa/eur ope or locations not listed: f reescale semiconductor t echnical inf or mation center , el516 2100 east elliot road t empe , ar iz ona 85284 +1-800-521-6274 or +1-480-768-2130 www .freescale .com/suppor t eur ope , mid dle east, and africa: f reescale halb leiter deutschland gmbh t echnical inf or mation center schatzbogen 7 81829 muenchen, ger man y +44 1296 380 456 (english) +46 8 52200080 (english) +49 89 92103 559 (ger man) +33 1 69 35 48 48 (f rench) www .freescale .com/suppor t japan: f reescale semiconductor j apan ltd. headquar ters arco t o w er 15f 1-8-1, shimo-meguro , meguro-ku, t oky o 153-0064 j apan 0120 191014 or +81 3 5437 9125 suppor t.japan@freescale .com asia/p acific: f reescale semiconductor china ltd. exchange building 23f no . 118 jianguo road chao y ang distr ict beijing 100022 china +86 10 5879 8000 suppor t.asia@freescale .com for literature requests onl y: f reescale semiconductor liter ature distr ib ution center 1-800-441-2447 or +1-303-675-2140 f ax: +1-303-675-2150 ldcf orf reescalesemiconductor@hib ber tg roup .com document number : AN4025 re v . 1, 4/2010 information in this document is pro vided solely to enable system and sofw are implementers to use freescale semiconductors products. there are no e xpress or implied cop yright licenses granted hereunder to design or f abricate an y inte grated circuits or inte grated circuits based on the information in this document. freescale semiconductor reserv es the right to mak e changes without further notice to an y products herein. freescale semiconductor mak es no w arranty , representation, or guarantee re g arding the suitability of its products for an y particular purpose, nor does freescale semiconductor assume an y liability arising out of the application or use of an y product or circuit, and specifcally disclaims an y liability , including without limitation consequential or incidental damages. "t ypical" parameters that may be pro vided in freescale semiconductor data sheets and/or specifcations can and do v ary in dif ferent applications and actual performance may v ary o v er time. all operating parameters, including "t ypicals", must be v alidated for each customer application by customer's technical e xperts. freescale semiconductor does not con v e y an y license under its patent rights nor the rights of others. freescale semiconductor prodcuts are not designed, intended, or authorized for use as components in systems intended for sur gical implant into the body , or other applications intended to support or sustain life, or for an y other application in which f ailure of the freescale semiconductor product could create a situation where personal injury or death may occur . should buyer purchase or use freescale semiconductor products for an y such unintended or unauthorized application, buyer shall indemnify freescale semiconductor and its offcers, emplo yees, subsidiaries, affliates, and distrib utors harmless ag ainst all claims, costs, damages, and e xpenses, and reasonable attorne y fees arising out of, directly or indirectly , an y claim of personal injury or death associated with such unintended or unauthorized use, e v en if such claims alle ges that freescale semiconductor w as ne gligent re g arding the design or manuf acture of the part. rohs-compliant and/or pb-free v ersions of freescale products ha v e the functionality and electrical characteristics as their non-rohs-complaint and/or non-pb-free counterparts. f or further information, see http://www .freescale.com or contact your freescale sales representati v e. f or information on freescale's en vironmental products program, go to http://www .freescale.com/epp. freescale? and the freescale logo are trademarks of freescale semiconductor , inc. all other product or service names are the property of their respecti v e o wners. ? 2010 freescale semiconductor , inc.


▲Up To Search▲   

 
Price & Availability of AN4025

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X